const v8 = require('v8');
const fs = require('fs');

//缓存数据版本标签
// const cachedDataVersionTag = v8.cachedDataVersionTag();

//堆与代码的统计信息
// const heapCodeStatistics = v8.getHeapCodeStatistics();

/**
 * 获取内存堆快照
 * 返回可读流，写入文件中，用工具分析
 */
// const heapSnapStream  = v8.getHeapSnapshot();

/**
 * 写入文件
 */
// const snapshotFile = fs.createWriteStream('HeapSnapshot.heapsnapshot')
// heapSnapStream.pipe(snapshotFile);

//堆内存空间统计信息
// const heapSpaceStatistics = v8.getHeapSpaceStatistics();

//堆内存统计信息
const heapStats = v8.getHeapStatistics();

console.dir(heapStats);



